package com.jf3q.iot.dto;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class ResultBean {


    private Integer code;
    private String message;
    private Object data;


    public static ResultBean success(String message,Object data ){
        return new ResultBean(ResultCode.SUCCESS.getCode(),message,data);
    }


    public static ResultBean error(String message ){
        return new ResultBean(ResultCode.ERROR.getCode(),message,null);
    }

    //自定义异常的时候使用
    public static ResultBean error( Integer code,String message ){
        return new ResultBean(code,message,null);
    }
}
